Optimal. Leaf size=60 \[ \frac {a^2 (a+b x)^{1+n}}{b^3 (1+n)}-\frac {2 a (a+b x)^{2+n}}{b^3 (2+n)}+\frac {(a+b x)^{3+n}}{b^3 (3+n)} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.01, antiderivative size = 60, normalized size of antiderivative = 1.00, number of steps
used = 2, number of rules used = 1, integrand size = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.091, Rules used = {45}
\begin {gather*} \frac {a^2 (a+b x)^{n+1}}{b^3 (n+1)}-\frac {2 a (a+b x)^{n+2}}{b^3 (n+2)}+\frac {(a+b x)^{n+3}}{b^3 (n+3)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 45
Rubi steps
\begin {align*} \int x^2 (a+b x)^n \, dx &=\int \left (\frac {a^2 (a+b x)^n}{b^2}-\frac {2 a (a+b x)^{1+n}}{b^2}+\frac {(a+b x)^{2+n}}{b^2}\right ) \, dx\\ &=\frac {a^2 (a+b x)^{1+n}}{b^3 (1+n)}-\frac {2 a (a+b x)^{2+n}}{b^3 (2+n)}+\frac {(a+b x)^{3+n}}{b^3 (3+n)}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.04, size = 57, normalized size = 0.95 \begin {gather*} \frac {(a+b x)^{1+n} \left (2 a^2-2 a b (1+n) x+b^2 \left (2+3 n+n^2\right ) x^2\right )}{b^3 (1+n) (2+n) (3+n)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.11, size = 73, normalized size = 1.22
method | result | size |
gosper | \(\frac {\left (b x +a \right )^{1+n} \left (b^{2} n^{2} x^{2}+3 b^{2} n \,x^{2}-2 a b n x +2 x^{2} b^{2}-2 a b x +2 a^{2}\right )}{b^{3} \left (n^{3}+6 n^{2}+11 n +6\right )}\) | \(73\) |
risch | \(\frac {\left (b^{3} n^{2} x^{3}+a \,b^{2} n^{2} x^{2}+3 b^{3} n \,x^{3}+a \,b^{2} n \,x^{2}+2 b^{3} x^{3}-2 a^{2} b n x +2 a^{3}\right ) \left (b x +a \right )^{n}}{\left (2+n \right ) \left (3+n \right ) \left (1+n \right ) b^{3}}\) | \(88\) |
norman | \(\frac {x^{3} {\mathrm e}^{n \ln \left (b x +a \right )}}{3+n}+\frac {a n \,x^{2} {\mathrm e}^{n \ln \left (b x +a \right )}}{b \left (n^{2}+5 n +6\right )}+\frac {2 a^{3} {\mathrm e}^{n \ln \left (b x +a \right )}}{b^{3} \left (n^{3}+6 n^{2}+11 n +6\right )}-\frac {2 n \,a^{2} x \,{\mathrm e}^{n \ln \left (b x +a \right )}}{b^{2} \left (n^{3}+6 n^{2}+11 n +6\right )}\) | \(114\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.28, size = 68, normalized size = 1.13 \begin {gather*} \frac {{\left ({\left (n^{2} + 3 \, n + 2\right )} b^{3} x^{3} + {\left (n^{2} + n\right )} a b^{2} x^{2} - 2 \, a^{2} b n x + 2 \, a^{3}\right )} {\left (b x + a\right )}^{n}}{{\left (n^{3} + 6 \, n^{2} + 11 \, n + 6\right )} b^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.24, size = 96, normalized size = 1.60 \begin {gather*} -\frac {{\left (2 \, a^{2} b n x - {\left (b^{3} n^{2} + 3 \, b^{3} n + 2 \, b^{3}\right )} x^{3} - 2 \, a^{3} - {\left (a b^{2} n^{2} + a b^{2} n\right )} x^{2}\right )} {\left (b x + a\right )}^{n}}{b^{3} n^{3} + 6 \, b^{3} n^{2} + 11 \, b^{3} n + 6 \, b^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 597 vs.
\(2 (51) = 102\).
time = 0.37, size = 597, normalized size = 9.95 \begin {gather*} \begin {cases} \frac {a^{n} x^{3}}{3} & \text {for}\: b = 0 \\\frac {2 a^{2} \log {\left (\frac {a}{b} + x \right )}}{2 a^{2} b^{3} + 4 a b^{4} x + 2 b^{5} x^{2}} + \frac {3 a^{2}}{2 a^{2} b^{3} + 4 a b^{4} x + 2 b^{5} x^{2}} + \frac {4 a b x \log {\left (\frac {a}{b} + x \right )}}{2 a^{2} b^{3} + 4 a b^{4} x + 2 b^{5} x^{2}} + \frac {4 a b x}{2 a^{2} b^{3} + 4 a b^{4} x + 2 b^{5} x^{2}} + \frac {2 b^{2} x^{2} \log {\left (\frac {a}{b} + x \right )}}{2 a^{2} b^{3} + 4 a b^{4} x + 2 b^{5} x^{2}} & \text {for}\: n = -3 \\- \frac {2 a^{2} \log {\left (\frac {a}{b} + x \right )}}{a b^{3} + b^{4} x} - \frac {2 a^{2}}{a b^{3} + b^{4} x} - \frac {2 a b x \log {\left (\frac {a}{b} + x \right )}}{a b^{3} + b^{4} x} + \frac {b^{2} x^{2}}{a b^{3} + b^{4} x} & \text {for}\: n = -2 \\\frac {a^{2} \log {\left (\frac {a}{b} + x \right )}}{b^{3}} - \frac {a x}{b^{2}} + \frac {x^{2}}{2 b} & \text {for}\: n = -1 \\\frac {2 a^{3} \left (a + b x\right )^{n}}{b^{3} n^{3} + 6 b^{3} n^{2} + 11 b^{3} n + 6 b^{3}} - \frac {2 a^{2} b n x \left (a + b x\right )^{n}}{b^{3} n^{3} + 6 b^{3} n^{2} + 11 b^{3} n + 6 b^{3}} + \frac {a b^{2} n^{2} x^{2} \left (a + b x\right )^{n}}{b^{3} n^{3} + 6 b^{3} n^{2} + 11 b^{3} n + 6 b^{3}} + \frac {a b^{2} n x^{2} \left (a + b x\right )^{n}}{b^{3} n^{3} + 6 b^{3} n^{2} + 11 b^{3} n + 6 b^{3}} + \frac {b^{3} n^{2} x^{3} \left (a + b x\right )^{n}}{b^{3} n^{3} + 6 b^{3} n^{2} + 11 b^{3} n + 6 b^{3}} + \frac {3 b^{3} n x^{3} \left (a + b x\right )^{n}}{b^{3} n^{3} + 6 b^{3} n^{2} + 11 b^{3} n + 6 b^{3}} + \frac {2 b^{3} x^{3} \left (a + b x\right )^{n}}{b^{3} n^{3} + 6 b^{3} n^{2} + 11 b^{3} n + 6 b^{3}} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 140 vs.
\(2 (60) = 120\).
time = 2.25, size = 140, normalized size = 2.33 \begin {gather*} \frac {{\left (b x + a\right )}^{n} b^{3} n^{2} x^{3} + {\left (b x + a\right )}^{n} a b^{2} n^{2} x^{2} + 3 \, {\left (b x + a\right )}^{n} b^{3} n x^{3} + {\left (b x + a\right )}^{n} a b^{2} n x^{2} + 2 \, {\left (b x + a\right )}^{n} b^{3} x^{3} - 2 \, {\left (b x + a\right )}^{n} a^{2} b n x + 2 \, {\left (b x + a\right )}^{n} a^{3}}{b^{3} n^{3} + 6 \, b^{3} n^{2} + 11 \, b^{3} n + 6 \, b^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.56, size = 192, normalized size = 3.20 \begin {gather*} \left \{\begin {array}{cl} \frac {2\,a^2\,\ln \left (a+b\,x\right )+b^2\,x^2-2\,a\,b\,x}{2\,b^3} & \text {\ if\ \ }n=-1\\ \frac {x}{b^2}-\frac {a^2}{b^3\,\left (a+b\,x\right )}-\frac {2\,a\,\ln \left (a+b\,x\right )}{b^3} & \text {\ if\ \ }n=-2\\ \frac {\ln \left (a+b\,x\right )+\frac {2\,a}{a+b\,x}-\frac {a^2}{2\,{\left (a+b\,x\right )}^2}}{b^3} & \text {\ if\ \ }n=-3\\ \frac {2\,{\left (a+b\,x\right )}^{n+1}\,\left (8\,a^2-8\,a\,b\,n\,x-8\,a\,b\,x+4\,b^2\,n^2\,x^2+12\,b^2\,n\,x^2+8\,b^2\,x^2\right )}{b^3\,\left (8\,n^3+48\,n^2+88\,n+48\right )} & \text {\ if\ \ }n\neq -1\wedge n\neq -2\wedge n\neq -3 \end {array}\right . \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________